package cn.iocoder.yudao.module.vote.dal.mysql.voteHead;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.vote.dal.dataobject.voteHead.VoteHeadDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.vote.controller.admin.voteHead.vo.*;

/**
 * 投票头 Mapper
 *
 * @author 吕小文
 */
@Mapper
public interface VoteHeadMapper extends BaseMapperX<VoteHeadDO> {

    default PageResult<VoteHeadDO> selectPage(VoteHeadPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<VoteHeadDO>()
                .likeIfPresent(VoteHeadDO::getName, reqVO.getName())
                .eqIfPresent(VoteHeadDO::getActNo, reqVO.getActNo())
                .eqIfPresent(VoteHeadDO::getActCoverKey, reqVO.getActCoverKey())
                .eqIfPresent(VoteHeadDO::getActVideoKeys, reqVO.getActVideoKeys())
                .eqIfPresent(VoteHeadDO::getActPicKeys, reqVO.getActPicKeys())
                .eqIfPresent(VoteHeadDO::getSubject, reqVO.getSubject())
                .eqIfPresent(VoteHeadDO::getDescription, reqVO.getDescription())
                .eqIfPresent(VoteHeadDO::getSort, reqVO.getSort())
                .eqIfPresent(VoteHeadDO::getStatus, reqVO.getStatus())
                .betweenIfPresent(VoteHeadDO::getStartTime, reqVO.getStartTime())
                .betweenIfPresent(VoteHeadDO::getEndTime, reqVO.getEndTime())
                .eqIfPresent(VoteHeadDO::getVoteRule, reqVO.getVoteRule())
                .eqIfPresent(VoteHeadDO::getVoteRange, reqVO.getVoteRange())
                .eqIfPresent(VoteHeadDO::getVoteRangeItem, reqVO.getVoteRangeItem())
                .eqIfPresent(VoteHeadDO::getUserId, reqVO.getUserId())
                .eqIfPresent(VoteHeadDO::getResultRule, reqVO.getResultRule())
                .eqIfPresent(VoteHeadDO::getVoteType, reqVO.getVoteType())
                .betweenIfPresent(VoteHeadDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(VoteHeadDO::getId));
    }

}